using UnityEngine;
using System.Collections;

public class PlayerState : MonoBehaviour {
	public Transform weaponContainer;
	
	// Returns the currently equiped Entity.
	public Entity getWeapon() {
		if (weaponContainer != null) {
			Entity weapon = null;
			int i = weaponContainer.GetChildCount() - 1;
			
			while (weapon == null && i >= 0) {
				weapon = weaponContainer.GetChild(i).GetComponent<Entity>();
				i--;
			}
			
			return weapon;
		}
		
		return null;
	}
	
	// Returns the currently equiped Entity.
	public Animator getAnimator() {
		return GetComponentInChildren<Animator>();
	}
}